<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>{:session('cp.cpsysname')}--商户管理平台</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta name="description" content="{:config('webconfig.description');}">
        <meta name="keywords" content="{:config('webconfig.keywords');}">
        <meta name="author" content="runoob">
        <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrap-datetimepicker.css"/>
        <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
        <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
        <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
        <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script src="__STATIC_URL__/static/layer/3.0.3/layer.js"></script>
        <script src="__STATIC_URL__/static/js/commen.js"></script>
        <style type="text/css">
            .red{
                color: #FF6667;
            }
            .green{
                color: #66CC99;
            }
            .persont{
                font-size: 12px;
            }
        </style>
    </head>
    <body>
    {include file='public/header'/}
    <section>
        <!------------------导航-------------------------->
        {include file='public/left'/}
        <!--------------------------主要内容区域------------------------------------->
        <div class="content">
            <div class="page-heading mgl15 mgr15">
                <ol class="breadcrumb">
                    <li>当前位置是&nbsp;:</li>
                    <li>
                        <a href="#">交易中心</a>
                    </li>
                    <li class="active" >交易统计</li>
                </ol>
            </div>
            <div class="mgl15 mgr15">
                <div class="panel panel-default panel-search">
                    <div class="panel-heading">
                        <h5 class="panel-title"><span class="glyphicon glyphicon-search pull-left" style="margin-right: 10px;"></span>条件筛选</h5>
                    </div>
                    <div class="panel-body">
                        <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                            <div class="col-sm-6 col-md-6 col-lg-4 ">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">门店：</label>
                                    <div class="col-sm-9">
                                        <select name="machname" class="form-control">
                                            <option value="">所有门店</option>
                                            {volist name="machlist" id="search"}
                                            <option value="{$search.merchant}" {if condition="$p_data['machname'] eq $search.merchant"}selected{/if}>{$search.merchant}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-4 col-slg-3">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">时间：</label>
                                    <div class="col-sm-9">
                                        <div class="input-group">
                                            <input name="starttime" type="text" value="{$p_data['starttime']}" readonly="readonly" id="startime" placeholder="请选择" class="form-control">
                                            <div class="input-group-addon">至</div>
                                            <input name="endtime" type="text" value="{$p_data['endtime']}" readonly="readonly" id="endtime" class="form-control" placeholder="请选择">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-4 col-slg-3">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">金额：</label>
                                    <div class="col-sm-9">
                                        <div class="input-group">
                                            <input name="startprice" type="text" value="{$p_data['startprice']}"  oninput="value = value.replace(/[^\d.]/g, '')" placeholder="最低金额" class="form-control">
                                            <div class="input-group-addon">至</div>
                                            <input name="endprice" type="text" value="{$p_data['endprice']}"  oninput="value = value.replace(/[^\d.]/g, '')" class="form-control" placeholder="最高金额">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="panel-footer">
                        <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                        <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h5 class="panel-title">
                            门店分析
                        </h5>
                    </div>
                    <div class="panel-body">
                        <ul class="fenxilist clearfix">
                            <li class="col-sm-2">
                                <div>交易笔数(笔)</div>
                                <div>{$jy['dayordercount']}</div>
                                <!--<div>-->
                                    <!--<span>周同比:</span>-->
                                    <!--<span class="persontnum">-0.3%</span>-->
                                    <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </li>
                            <li class="col-sm-2">
                                <div>交易金额(元)</div>
                                <div>{$jy['daypricecount']}</div>
                                <!--<div>-->
                                    <!--<span>周同比:</span>-->
                                    <!--<span class="persontnum">+7.3%</span>-->
                                    <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </li>
                            <li class="col-sm-2">
                                <div>实收金额(元)</div>
                                <div>¥{$jy['dayss']}</div>
                                <!--<div>-->
                                    <!--<span>周同比:</span>-->
                                    <!--<span class="persontnum">+7.3%</span>-->
                                    <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </li>
                            <li class="col-sm-2">
                                <div>单笔单价(元)</div>
                                <div>{$jy['dbj']}</div>
                                <!--<div>-->
                                    <!--<span>周同比:</span>-->
                                    <!--<span class="persontnum">-0.3%</span>-->
                                    <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </li>
                            <li class="col-sm-2">
                                <!--<div>门店个数(个)</div>-->
                                <!--<div>$jy['zmerchant']</div>-->
                                <div>退款笔数(笔)</div>
                                <div>{$jy['daytkbs']}</div>
                                <!--<div>-->
                                    <!--<span>周同比:</span>-->
                                    <!--<span class="persontnum">-0.3%</span>-->
                                    <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </li>
                            <li class="col-sm-2">
                                <!--<div>交易门店数(个)</div>-->
                                <!--<div>$jy['zmerchant']</div>-->
                                <div>退款金额(元)</div>
                                <div>{$jy['daytkprice']}</div>
                                <!--<div>-->
                                    <!--<span>周同比:</span>-->
                                    <!--<span class="persontnum">-0.3%</span>-->
                                    <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </li>

                        </ul>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading" style="position:relative;">
                        <h5 class="panel-title">
                            门店列表
                        </h5>
               
                    </div>
                    <div class="panel-body">
                        <table class="table table-bordered" id="tableExcel">
                            <thead>
                                <tr>
                                    <th>门店名称</th>
                                    <th>服务商名称</th>
                                    <th>业务员</th>
                                    <th>交易金额</th>
                                    <th>实收金额</th>
                                    <th>交易笔数</th>
                                    <th>笔单价</th>
                                    <th>退款笔数</th>
                                    <th>退款金额</th>
                                </tr>
                            </thead>
                            <tbody>
                             {volist name="mach" id="vo"}
                                <tr>
                                    <td>{$vo.merchant}</td>
                                    <td>{$vo.agent}</td>
                                    <td>{$vo.salesman}</td>
                                    <td>{$vo.price}</td>
                                    <td>¥{$vo.dayss}</td>
                                    <td>{$vo.orders}</td>
                                    <td>￥{$vo.dbj}</td>
                                    <td>{$vo.tkbs}</td>
                                    <td>¥{$vo.tkprice}</td>
                                </tr>
                             {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            {include file='public/footer'/}
        </div>
    </section>
</body>
<script src="__STATIC_URL__/static/js/commen.js" type="text/javascript" charset="utf-8"></script>
<script src="__STATIC_URL__/static/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    $(function () {
        var myDate = new Date();
        var hm = Date.parse(myDate)-86400000;
        $('#startime').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            autoclose: true,
            todayHighlight:true,
            endDate:new Date(hm)
        }).on('changeDate', function (ev) {
            var starttime = $('#startime').val();
            var endtime = $('#endtime').val();
            if (starttime != "" && endtime != "") {
                var startD = new Date(Date.parse(starttime.replace(/-/g, "/")));
                var endD = new Date(Date.parse(endtime.replace(/-/g, "/")));
                var days = parseInt((endD.getTime() - startD.getTime()) / (1000 * 60 * 60 * 24));
                if (days > 31) {
                    alert("日期范围应在一个月之内");
                    $('#startime').val('');
                    return false;
                };
                if (endtime < starttime) {
                    $('#startime').val('');
                    alert('开始时间必须大于结束时间');
                    return;
                };
                $("#endtime").datetimepicker('setStartDate',starttime);
                $("#starttime").datetimepicker('hide');
            }
        });
        $('#endtime').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            autoclose: true,
            todayHighlight:false,
            endDate: new Date(hm)
        }).on('changeDate', function (ev) {
            var starttime = $('#startime').val();
            var endtime = $('#endtime').val();
            if (starttime != "" && endtime != "") {
                var startD = new Date(Date.parse(starttime.replace(/-/g, "/")));
                var endD = new Date(Date.parse(endtime.replace(/-/g, "/")));
                var days = parseInt((endD.getTime() - startD.getTime()) / (1000 * 60 * 60 * 24));
                if (days > 31) {
                    alert("日期范围应在一个月之内");
                    $('#endtime').val('');
                    return false;
                };
                if (endtime < starttime) {
                    $('#endtime').val('');
                    alert('开始时间必须大于结束时间');
                    return;
                };
                $("#starttime").datetimepicker('setEndDate',endtime);
                $("#endttime").datetimepicker('hide');
            }
        });
    });
//筛选
    function filter() {
        var ii = layer.load();
        setTimeout(function () {
            layer.close(ii);
        }, 1000);
        $("#countform").submit();

    }
//清空筛选条件
    $(function () {
        $("#payclear").click(function () {
            $(".form-virtical input").val("");
            $(".form-virtical select").val("");
        })
    })
</script>
<script type="text/javascript">
    $(".persontnum").each(function (i) {
        var val = $(this).text();
        var type = val[0];
        if (type == "-") {
            $(this).next(".glyphicon").addClass("glyphicon-arrow-down");
            $(this).next(".glyphicon").addClass("green");
        } else if (type == "+") {
            $(this).next(".glyphicon").addClass("glyphicon-arrow-up");
            $(this).next(".glyphicon").addClass("red");
        }
    })
</script>
</html>
